//
//  StateManager.swift
//  SwiftUI_App
//
//  Created by qingzhou on 2021/6/7.
//

import Foundation

import Combine

class StateManager: ObservableObject {
    @Published var selection: Int = 1
    @Published var firstDetailsShow:Bool = false
    @Published var selectedItem: String? = nil
    var subscriptions = Set<AnyCancellable>()
    init() {
//        $firstDetailsShow
//            .filter({ !$0 })
//            .removeDuplicates()
//            .sink { [unowned self] value in
//                self.selectedItem = nil
//            }.store(in: &subscriptions)
    }
    
    func goToFirstRootView() {
        selectedItem = nil
        firstDetailsShow = false
    }
}
